import type { AppRouteModule } from '@/router/types';
import { LAYOUT, getParentLayout } from '@/router/constant';

const wmsRoutes: AppRouteModule = {
  path: '/wms',
  name: 'Wms',
  component: LAYOUT,
  redirect: '/wms/brand',
  meta: {
    icon: 'clarity:rack-server-solid',
    title: 'WMS',
    orderNo: 4000,
  },
  children: [
    {
      path: 'settings',
      name: 'SettingsPage',
      component: getParentLayout('SettingsPage'),
      meta: {
        icon: 'icon-park:setting-two',
        title: '基础配置',
        roles: [
          'Root.Admin.Wms.Material.ReadTree',
          'Root.Admin.Wms.WareHouse.Read',
          'Root.Admin.Wms.WareHouseArea.Read',
          'Root.Admin.Wms.WareHouseAreaPos.Read',
        ],
      },
      children: [
        {
          path: 'materialcategorys',
          name: 'MaterialCategoryPage',
          component: () => import('/@/views/wms/materialcategorys/MaterialCategoryPage.vue'),
          meta: {
            icon: '',
            title: '物料分类',
            roles: ['Root.Admin.Wms.MaterialCategory.ReadTree'],
          },
        },
        {
          path: 'wareHouses',
          name: 'WareHousesPage',
          component: getParentLayout('WareHousesPage'),
          meta: {
            icon: '',
            title: '仓库配置',
            roles: [
              'Root.Admin.Wms.WareHouse.Read',
              'Root.Admin.Wms.WareHouseArea.Read',
              'Root.Admin.Wms.WareHouseAreaPos.Read',
            ],
          },
          children: [
            {
              path: 'warehouse',
              name: 'WareHousePage',
              component: () => import('/@/views/wms/warehouses/warehouse/WareHousePage.vue'),
              meta: {
                title: '仓库',
                roles: ['Root.Admin.Wms.WareHouse.Read'],
              },
            },
            {
              path: 'warehousearea',
              name: 'WareHouseAreaPage',
              component: () =>
                import('/@/views/wms/warehouses/warehousearea/WareHouseAreaPage.vue'),
              meta: {
                title: '库区',
                roles: ['Root.Admin.Wms.WareHouseArea.Read'],
              },
            },
            {
              path: 'warehouseareapos',
              name: 'WareHouseAreaPosPage',
              component: () =>
                import('/@/views/wms/warehouses/warehouseareapos/WareHouseAreaPosPage.vue'),
              meta: {
                title: '库位',
                roles: ['Root.Admin.Wms.WareHouseAreaPos.Read'],
              },
            },
          ],
        },
      ],
    },
    {
      path: 'ipns',
      name: 'IPNsPage',
      component: () => import('/@/views/wms/ipns/IPNPage.vue'),
      meta: {
        icon: 'tabler:number',
        title: 'IPN',
        roles: ['Root.Admin.Wms.IPN.Read'],
      },
    },
    {
      path: 'material',
      name: 'MaterialPage',
      component: () => import('/@/views/wms/materials/material/MaterialPage.vue'),
      meta: {
        icon: 'lucide:warehouse',
        title: '库存',
        roles: ['Root.Admin.Wms.Material.Read'],
      },
    },
    {
      path: 'materialinstorage',
      name: 'MaterialInStoragePage',
      component: () => import('/@/views/wms/materials/materialinstorage/MaterialInStoragePage.vue'),
      meta: {
        icon: 'maki:warehouse',
        title: '入库',
        roles: ['Root.Admin.Wms.MaterialInStorage.Read'],
      },
    },
    {
      path: 'materialoutstorage',
      name: 'MaterialOutStoragePage',
      component: () =>
        import('/@/views/wms/materials/materialoutstorage/MaterialOutStoragePage.vue'),
      meta: {
        icon: 'streamline:shipping-transfer-cart-package-box-fulfillment-cart-warehouse-shipping-delivery',
        title: '出库',
        roles: ['Root.Admin.Wms.MaterialOutStorage.Read'],
      },
    },
  ],
};

export default wmsRoutes;
